home *** CD-ROM | disk | FTP | other *** search
/ The Trig Explorer / The Trig Explorer.iso / mac / Explorer / plot.dxr / 00114.ls < prev    next >
Encoding:
Text File  |  2000-08-01  |  1.8 KB  |  54 lines

  1. on mouseDown me
  2.   set L0 to the left of sprite 2
  3.   set r0 to the right of sprite 2
  4.   set the floatPrecision to 1
  5.   set the cursor of sprite the spriteNum of me to [member "Closed Hand", member "Closed Hand Mask"]
  6.   repeat while the stillDown
  7.     if (the mouseH < r0) and (the mouseH > (L0 + 8)) then
  8.       set the locH of sprite 3 to the mouseH
  9.       put 0 + float((the locH of sprite 3 - L0) / 82.0) into field "A"
  10.     end if
  11.     updateStage()
  12.   end repeat
  13. end
  14.  
  15. on mouseUp me
  16.   set the trails of sprite 19 to 1
  17.   if the foreColor of sprite 19 >= 6 then
  18.     set the foreColor of sprite 19 to 0
  19.   else
  20.     set the foreColor of sprite 19 to the foreColor of sprite 19 + 1
  21.   end if
  22.   set the cursor of sprite the spriteNum of me to [member "Hand", member "Hand Mask"]
  23.   updateStage()
  24.   set x0 to the locH of sprite 12 + 1
  25.   set y0 to the locV of sprite 12
  26.   repeat with n = 0 to 240
  27.     set the locH of sprite 19 to (2.39999999999999991 * n) + x0
  28.     if the hilite of cast "Sine" then
  29.       set the locV of sprite 19 to y0 - (50.0 * float(sin(float(field "A") * n * 3.0 * PI / 180.0)))
  30.     end if
  31.     if the hilite of cast "Cosine" then
  32.       set the locV of sprite 19 to y0 - (50.0 * float(cos(float(field "A") * n * 3.0 * PI / 180.0)))
  33.     end if
  34.     if the hilite of cast "Tangent" then
  35.       set the locV of sprite 19 to y0 - (50.0 * float(tan(float(field "A") * n * 3.0 * PI / 180.0)))
  36.     end if
  37.     updateStage()
  38.   end repeat
  39.   set the locV of sprite 19 to 900
  40. end
  41.  
  42. on beginSprite me
  43.   set the cursor of sprite the spriteNum of me to [member "Hand", member "Hand Mask"]
  44.   put "2" into field "A"
  45.   set the locH of sprite 3 to the left of sprite 2 + (84 * 2)
  46.   set the hilite of cast "Sine" to 1
  47.   set the hilite of cast "Cosine" to 0
  48.   set the hilite of cast "Tangent" to 0
  49. end
  50.  
  51. on endSprite me
  52.   set the cursor of sprite the spriteNum of me to 0
  53. end
  54.